
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define N		20
#define LEN		10


char g_num[N][LEN]; 
int	n; 

void join_str(char *res, const char *a, const char *b)
{
	while(*a)
		*res++ = *a++; 
	while(*b)
		*res++ = *b++; 
	*res = '\0';
}

int cmp(const void *a, const void *b)
{
	char	ab[2*LEN], ba[2*LEN]; 
	int		ret; 
	
	join_str(ab, (const char *)a, (const char *)b); 
	join_str(ba, (const char *)b, (const char *)a); 
	ret = -1*strcmp(ab, ba); 
	
	return ret; 
}


int main()
{
	int	i; 
	scanf("%d", &n); 
	for (i=0; i<n; i++) {
		scanf("%s", g_num[i]); 
	}
	qsort(g_num, n, LEN*sizeof(char), cmp); 
	for(i=0; i<n; i++) 
		printf("%s", g_num[i]); 
	printf("\n"); 
	return 0; 
}





